package housing.task1;

import housing.task1.actor.Dispatcher;
import housing.task1.actor.Renter;
import housing.task1.actor.Worker;
import housing.task1.document.Request;
import housing.task1.document.WorkPlan;

import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: Linderhof
 * Date: 10.11.2010
 * Time: 0:44:38
 * To change this template use File | Settings | File Templates.
 */
public class Main1 {
    public static void main(String[] args) {
        ArrayList<Renter> renters = new ArrayList<Renter>();
        ArrayList<Worker> workers = new ArrayList<Worker>();
        Dispatcher Manager = new Dispatcher();
        //Requests are stored in WorkPlan.requests
        ArrayList<Request> requests = WorkPlan.getInstance().getRequests();


        //creating Renter.xsd
        for (int i = 0; i < 10; ++i) {
            renters.add(new Renter());
        }
        System.out.println("Renters:");
        int count = 1;
        for (Renter r : renters) {
            System.out.println(count + " " + r);
            ++count;
        }


        //creating Workers.
        // They are automatically added to the WorkPlan.workers,
        //so an WP instance is created
        for (int i = 0; i < 10; ++i) {
            workers.add(new Worker());
        }
        System.out.println("Workers:");
        count = 1;
        for (Worker w : workers) {
            System.out.println(count + " " + w);
            ++count;
        }

        //Sending requests
        for (Renter r : renters) {
            r.act();
//            r.sendRequest(AutoCompleter.WorkType.generateWorkType(), AutoCompleter.WorkScale.generateWorkScale(),
//                    AutoCompleter.generateDate());
        }
        System.out.println("Requests: ");

        count = 1;
        for (Request request : requests) {
            System.out.println(count + " " + request);
            ++count;
        }

        Dispatcher d = new Dispatcher();
        d.act();

        for (Worker w : workers) {
            w.act();
        }

    }
}
